/**
 * 各种转换器的入口文件
 */
import moduleCss from './converters.module.css';
import classNames from 'classnames/bind';
import {Outlet, useNavigate} from 'react-router-dom';

function Converters() {
    const styles = classNames.bind(moduleCss);
    const navigate = useNavigate();

    // 处理点击事件，切换路由地址
    const onSwitchClick = (path: string) => {
        navigate(path, {replace: true});
    }

    return (
        <div className={styles('root-container')}>
            <div>
                <button onClick={() => onSwitchClick('/converters/pdf2img')}>PDF转图片</button>
                <button onClick={() => onSwitchClick('/converters/word2img')}>Word转图片</button>
            </div>
            <div>
                <Outlet/>
            </div>
        </div>
    );
}

export default Converters;